-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api): improve analysis cli #15027
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we care that if they specify --json-output - --human-json-output -
that it will be a whole lot of output piped to stdout? I think the answer is no, but wanted to check.
Also should add some tests for the changes in this PR
nope! if you want to do that, you can.
the changes in this pr are all interface-level changes that we don't really test for most of our code (including this one - there is no explicit testing for argument handling behavior. i'll make sure that the human-output stuff is parsable, but I don't intend to add exhaustive argument handling tests. |
okay I did add some though |
- adds a human-json-output flag that will output formatted json that is readable - adds a log-output and log-level flag to pipe logs around (default is stderr) - adds a check flag to control return code values - allows specifying stdout streams with - for file paths Closes EXEC-425
c4dc730
to
4295882
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
api/src/opentrons/cli/analyze.py
Outdated
type=click.Path(path_type=AsyncPath), | ||
type=click.File(mode="wb"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, using stdout for machine-readable output is unreliable because if we're analyzing a Python protocol, it can also print to stdout, and that will corrupt the JSON stream.
Should we print()
a warning if -
is specified, so it will fail early and obviously if somebody tries to rely on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO no, but we should put a warning in the help text. Somebody will only know to use that flag by actually reading the help text, so that should be good enough.
That's a good secondary improvement too - there's no reason we can't capture stdout and save it somewhere separate.
- adds a human-json-output flag that will output formatted json that is readable - adds a log-output and log-level flag to pipe logs around (default is stderr) - adds a check flag to control return code values - allows specifying stdout streams with - for file paths Closes EXEC-425
Closes EXEC-425